//
// Created by user on 2022/3/15.
//

#include <iostream>
using namespace std;
struct ListNode {
   int val;
   ListNode *next;
   ListNode(int x) : val(x), next(NULL) {}
    };

void deleteNode(ListNode* node) {
    ListNode *prev = nullptr;
    while (node!= nullptr){
        ListNode *next = node->next;
        if(next!= nullptr){
            node->val = next->val;
        } else{
            prev->next = next;
        }
        prev = node;
        node = node->next;
    }
}